package com.kawa.service.impl;

import com.kawa.constant.CommonConstants;
import com.kawa.entity.vo.LoginResult;
import com.kawa.mapper.UserLoginMapper;
import com.kawa.service.LogoutService;
import com.kawa.util.MD5Util;
import com.kawa.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LogoutServiceImpl implements LogoutService {

    @Autowired
    private RedisUtil redisUtil;

    /**
     *
     *
     * @param token 长期token
     * @return true/false
     */
    @Override
    public boolean UserLogout(String token) {
        if (token != null) {
            String Refresh_token = redisUtil.get("Access_token:"+token);
            redisUtil.delete("Refresh_token:"+ Refresh_token);
            redisUtil.delete("Access_token:"+token);
            return true;
        } else {
            return false;
        }

    }
}
